import 'package:common/common.dart';
import 'package:connectivity_plus/connectivity_plus.dart';

///一些静态配置
class AppConfig {
  ///测试环境和正式环境切换,
  /// false  是正式环境, true 是测试环境
  static const bool isDebug = true;

  /// sdk 配置参数
  static SdkConfig sdkConfig = SdkConfig.sdkConfig;

  // 渠道配置
  static String get appChanel => Device.isIOS
      ? "appstore"
      : (const String.fromEnvironment('APP_CHANNEL').isEmpty ? 'dev' : const String.fromEnvironment('APP_CHANNEL'));

// 网络状态
  static ConnectivityResult connectivityResult = ConnectivityResult.none;
}

/// 三方 sdk参数配置         ///
class SdkConfig {
  static SdkConfig get sdkConfig {
    return AppConfig.isDebug
        ? SdkConfig(
            // 测试环境
            baseUrl: "https://miaoqu.oyaoyin.com/api/v1",
            // baseUrl: "https://test.api.zxyai.com/api",
            // baseUrl: "https://api.zxyai.com/api",
            weChatAppId: 'wxefb03a962fb2a1e1',
            weChatUniversalLink: 'https://www.zxyai.com',
            buglyAndriodAppId: '39adb0d6ea',
            buglyIOSAppId: '580b811bf7',
            amapAndroidKey: '0812c2de3d0448a48a600feec1af10d7',
            amapIOSKey: '0e7a90bb48d5aebb9bd80bb42bd65813',
            amapWebKey: 'b8ba722c2a5e935d1d8a4496c1ec6841',
            jPushkey: '2f2de6bc7d1de0fdcc468cee',
          )
        : SdkConfig(
            // 正式环境
            baseUrl: "https://miaoqu.oyaoyin.com/api/v1",
            weChatAppId: 'wxefb03a962fb2a1e1',
            weChatUniversalLink: 'https://www.zxyai.com/',
            buglyAndriodAppId: '39adb0d6ea',
            buglyIOSAppId: '580b811bf7',
            amapAndroidKey: '0812c2de3d0448a48a600feec1af10d7',
            amapIOSKey: '0e7a90bb48d5aebb9bd80bb42bd65813',
            amapWebKey: 'b8ba722c2a5e935d1d8a4496c1ec6841',
            jPushkey: '2f2de6bc7d1de0fdcc468cee',
          );
  }

  /// api 地址
  late String baseUrl;

  ///微信appId
  late String weChatAppId;

  ///微信通用链接
  late String weChatUniversalLink;

  ///bugly安卓AppId
  late String buglyAndriodAppId;

  ///buglyiOSAppId
  late String buglyIOSAppId;

  late String amapAndroidKey; //高德地图 Android Key
  late String amapIOSKey; //高德地图 iOS Key
  late String amapWebKey; //高德地图 Web Key

  late String jPushkey; // 极光推送 Key

  SdkConfig({
    required this.baseUrl,
    required this.weChatAppId,
    required this.weChatUniversalLink,
    required this.buglyAndriodAppId,
    required this.buglyIOSAppId,
    required this.amapAndroidKey,
    required this.amapIOSKey,
    required this.amapWebKey,
    required this.jPushkey,
  });
}
